home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / PInterfaces / Icons.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  41.0 KB  |  1,269 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Icons.p
  3.  
  4.      Contains:    Icon Utilities and Icon Services Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1990-1998 by Apple Computer, Inc. All rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Icons;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __ICONS__}
  27. {$SETC __ICONS__ := 1}
  28.  
  29. {$I+}
  30. {$SETC IconsIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __MACTYPES__}
  34. {$I MacTypes.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __QUICKDRAW__}
  37. {$I Quickdraw.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __FILES__}
  40. {$I Files.p}
  41. {$ENDC}
  42. {$IFC UNDEFINED __CODEFRAGMENTS__}
  43. {$I CodeFragments.p}
  44. {$ENDC}
  45.  
  46.  
  47. {$PUSH}
  48. {$ALIGN MAC68K}
  49. {$LibExport+}
  50.  
  51. { The following are icons for which there are both icon suites and SICNs. }
  52. { Avoid using icon resources if possible. Use IconServices instead. }
  53.  
  54. CONST
  55.     kGenericDocumentIconResource = -4000;
  56.     kGenericStationeryIconResource = -3985;
  57.     kGenericEditionFileIconResource = -3989;
  58.     kGenericApplicationIconResource = -3996;
  59.     kGenericDeskAccessoryIconResource = -3991;
  60.     kGenericFolderIconResource    = -3999;
  61.     kPrivateFolderIconResource    = -3994;
  62.     kFloppyIconResource            = -3998;
  63.     kTrashIconResource            = -3993;
  64.     kGenericRAMDiskIconResource    = -3988;
  65.     kGenericCDROMIconResource    = -3987;
  66.  
  67. { The following are icons for which there are SICNs only. }
  68. { Avoid using icon resources if possible. Use IconServices instead. }
  69.     kDesktopIconResource        = -3992;
  70.     kOpenFolderIconResource        = -3997;
  71.     kGenericHardDiskIconResource = -3995;
  72.     kGenericFileServerIconResource = -3972;
  73.     kGenericSuitcaseIconResource = -3970;
  74.     kGenericMoverObjectIconResource = -3969;
  75.  
  76. { The following are icons for which there are icon suites only. }
  77. { Avoid using icon resources if possible. Use IconServices instead. }
  78.     kGenericPreferencesIconResource = -3971;
  79.     kGenericQueryDocumentIconResource = -16506;
  80.     kGenericExtensionIconResource = -16415;
  81.     kSystemFolderIconResource    = -3983;
  82.     kHelpIconResource            = -20271;
  83.     kAppleMenuFolderIconResource = -3982;
  84.  
  85. { Obsolete. Use named constants defined above. }
  86.     genericDocumentIconResource    = -4000;
  87.     genericStationeryIconResource = -3985;
  88.     genericEditionFileIconResource = -3989;
  89.     genericApplicationIconResource = -3996;
  90.     genericDeskAccessoryIconResource = -3991;
  91.     genericFolderIconResource    = -3999;
  92.     privateFolderIconResource    = -3994;
  93.     floppyIconResource            = -3998;
  94.     trashIconResource            = -3993;
  95.     genericRAMDiskIconResource    = -3988;
  96.     genericCDROMIconResource    = -3987;
  97.     desktopIconResource            = -3992;
  98.     openFolderIconResource        = -3997;
  99.     genericHardDiskIconResource    = -3995;
  100.     genericFileServerIconResource = -3972;
  101.     genericSuitcaseIconResource    = -3970;
  102.     genericMoverObjectIconResource = -3969;
  103.     genericPreferencesIconResource = -3971;
  104.     genericQueryDocumentIconResource = -16506;
  105.     genericExtensionIconResource = -16415;
  106.     systemFolderIconResource    = -3983;
  107.     appleMenuFolderIconResource    = -3982;
  108.  
  109. { Avoid using icon resources if possible. Use IconServices instead. }
  110.     kStartupFolderIconResource    = -3981;
  111.     kOwnedFolderIconResource    = -3980;
  112.     kDropFolderIconResource        = -3979;
  113.     kSharedFolderIconResource    = -3978;
  114.     kMountedFolderIconResource    = -3977;
  115.     kControlPanelFolderIconResource = -3976;
  116.     kPrintMonitorFolderIconResource = -3975;
  117.     kPreferencesFolderIconResource = -3974;
  118.     kExtensionsFolderIconResource = -3973;
  119.     kFontsFolderIconResource    = -3968;
  120.     kFullTrashIconResource        = -3984;
  121.  
  122. { Obsolete. Use named constants defined above. }
  123.     startupFolderIconResource    = -3981;
  124.     ownedFolderIconResource        = -3980;
  125.     dropFolderIconResource        = -3979;
  126.     sharedFolderIconResource    = -3978;
  127.     mountedFolderIconResource    = -3977;
  128.     controlPanelFolderIconResource = -3976;
  129.     printMonitorFolderIconResource = -3975;
  130.     preferencesFolderIconResource = -3974;
  131.     extensionsFolderIconResource = -3973;
  132.     fontsFolderIconResource        = -3968;
  133.     fullTrashIconResource        = -3984;
  134.  
  135.     kHuge1BitMask                = 'ich#';
  136.     kHuge4BitData                = 'ich4';
  137.     kHuge8BitData                = 'ich8';
  138.     kHuge32BitData                = 'ih32';
  139.     kHuge8BitMask                = 'h8mk';
  140.     kLarge1BitMask                = 'ICN#';
  141.     kLarge4BitData                = 'icl4';
  142.     kLarge8BitData                = 'icl8';
  143.     kLarge32BitData                = 'il32';
  144.     kLarge8BitMask                = 'l8mk';
  145.     kSmall1BitMask                = 'ics#';
  146.     kSmall4BitData                = 'ics4';
  147.     kSmall8BitData                = 'ics8';
  148.     kSmall32BitData                = 'is32';
  149.     kSmall8BitMask                = 's8mk';
  150.     kMini1BitMask                = 'icm#';
  151.     kMini4BitData                = 'icm4';
  152.     kMini8BitData                = 'icm8';
  153.  
  154. { Obsolete. Use names defined above. }
  155.     large1BitMask                = 'ICN#';
  156.     large4BitData                = 'icl4';
  157.     large8BitData                = 'icl8';
  158.     small1BitMask                = 'ics#';
  159.     small4BitData                = 'ics4';
  160.     small8BitData                = 'ics8';
  161.     mini1BitMask                = 'icm#';
  162.     mini4BitData                = 'icm4';
  163.     mini8BitData                = 'icm8';
  164.  
  165. { Alignment type values. }
  166.     kAlignNone                    = $00;
  167.     kAlignVerticalCenter        = $01;
  168.     kAlignTop                    = $02;
  169.     kAlignBottom                = $03;
  170.     kAlignHorizontalCenter        = $04;
  171.     kAlignAbsoluteCenter        = $05;
  172.     kAlignCenterTop                = $06;
  173.     kAlignCenterBottom            = $07;
  174.     kAlignLeft                    = $08;
  175.     kAlignCenterLeft            = $09;
  176.     kAlignTopLeft                = $0A;
  177.     kAlignBottomLeft            = $0B;
  178.     kAlignRight                    = $0C;
  179.     kAlignCenterRight            = $0D;
  180.     kAlignTopRight                = $0E;
  181.     kAlignBottomRight            = $0F;
  182.  
  183. { Obsolete. Use names defined above. }
  184.     atNone                        = $00;
  185.     atVerticalCenter            = $01;
  186.     atTop                        = $02;
  187.     atBottom                    = $03;
  188.     atHorizontalCenter            = $04;
  189.     atAbsoluteCenter            = $05;
  190.     atCenterTop                    = $06;
  191.     atCenterBottom                = $07;
  192.     atLeft                        = $08;
  193.     atCenterLeft                = $09;
  194.     atTopLeft                    = $0A;
  195.     atBottomLeft                = $0B;
  196.     atRight                        = $0C;
  197.     atCenterRight                = $0D;
  198.     atTopRight                    = $0E;
  199.     atBottomRight                = $0F;
  200.  
  201.  
  202. TYPE
  203.     IconAlignmentType                    = SInt16;
  204. { Transform type values. }
  205.  
  206. CONST
  207.     kTransformNone                = $00;
  208.     kTransformDisabled            = $01;
  209.     kTransformOffline            = $02;
  210.     kTransformOpen                = $03;
  211.     kTransformLabel1            = $0100;
  212.     kTransformLabel2            = $0200;
  213.     kTransformLabel3            = $0300;
  214.     kTransformLabel4            = $0400;
  215.     kTransformLabel5            = $0500;
  216.     kTransformLabel6            = $0600;
  217.     kTransformLabel7            = $0700;
  218.     kTransformSelected            = $4000;
  219.     kTransformSelectedDisabled    = $4001;
  220.     kTransformSelectedOffline    = $4002;
  221.     kTransformSelectedOpen        = $4003;
  222.  
  223. { Obsolete. Use names defined above. }
  224.     ttNone                        = $00;
  225.     ttDisabled                    = $01;
  226.     ttOffline                    = $02;
  227.     ttOpen                        = $03;
  228.     ttLabel1                    = $0100;
  229.     ttLabel2                    = $0200;
  230.     ttLabel3                    = $0300;
  231.     ttLabel4                    = $0400;
  232.     ttLabel5                    = $0500;
  233.     ttLabel6                    = $0600;
  234.     ttLabel7                    = $0700;
  235.     ttSelected                    = $4000;
  236.     ttSelectedDisabled            = $4001;
  237.     ttSelectedOffline            = $4002;
  238.     ttSelectedOpen                = $4003;
  239.  
  240.  
  241. TYPE
  242.     IconTransformType                    = SInt16;
  243. { Selector mask values. }
  244.  
  245. CONST
  246.     kSelectorLarge1Bit            = $00000001;
  247.     kSelectorLarge4Bit            = $00000002;
  248.     kSelectorLarge8Bit            = $00000004;
  249.     kSelectorLarge32Bit            = $00000008;
  250.     kSelectorLarge8BitMask        = $00000010;
  251.     kSelectorSmall1Bit            = $00000100;
  252.     kSelectorSmall4Bit            = $00000200;
  253.     kSelectorSmall8Bit            = $00000400;
  254.     kSelectorSmall32Bit            = $00000800;
  255.     kSelectorSmall8BitMask        = $00001000;
  256.     kSelectorMini1Bit            = $00010000;
  257.     kSelectorMini4Bit            = $00020000;
  258.     kSelectorMini8Bit            = $00040000;
  259.     kSelectorHuge1Bit            = $01000000;
  260.     kSelectorHuge4Bit            = $02000000;
  261.     kSelectorHuge8Bit            = $04000000;
  262.     kSelectorHuge32Bit            = $08000000;
  263.     kSelectorHuge8BitMask        = $10000000;
  264.     kSelectorAllLargeData        = $000000FF;
  265.     kSelectorAllSmallData        = $0000FF00;
  266.     kSelectorAllMiniData        = $00FF0000;
  267.     kSelectorAllHugeData        = $FF000000;
  268.     kSelectorAll1BitData        = $01010101;
  269.     kSelectorAll4BitData        = $02020202;
  270.     kSelectorAll8BitData        = $04040404;
  271.     kSelectorAll32BitData        = $08000808;
  272.     kSelectorAllAvailableData    = $FFFFFFFF;
  273.  
  274.  
  275. { Obsolete. Use names defined above. }
  276.     svLarge1Bit                    = $00000001;
  277.     svLarge4Bit                    = $00000002;
  278.     svLarge8Bit                    = $00000004;
  279.     svSmall1Bit                    = $00000100;
  280.     svSmall4Bit                    = $00000200;
  281.     svSmall8Bit                    = $00000400;
  282.     svMini1Bit                    = $00010000;
  283.     svMini4Bit                    = $00020000;
  284.     svMini8Bit                    = $00040000;
  285.     svAllLargeData                = $000000FF;
  286.     svAllSmallData                = $0000FF00;
  287.     svAllMiniData                = $00FF0000;
  288.     svAll1BitData                = $01010101;
  289.     svAll4BitData                = $02020202;
  290.     svAll8BitData                = $04040404;
  291.     svAllAvailableData            = $FFFFFFFF;
  292.  
  293.  
  294. TYPE
  295.     IconSelectorValue                    = UInt32;
  296. {$IFC TYPED_FUNCTION_POINTERS}
  297.     IconActionProcPtr = FUNCTION(theType: ResType; VAR theIcon: Handle; yourDataPtr: UNIV Ptr): OSErr;
  298. {$ELSEC}
  299.     IconActionProcPtr = ProcPtr;
  300. {$ENDC}
  301.  
  302.     IconActionUPP = UniversalProcPtr;
  303.  
  304. CONST
  305.     uppIconActionProcInfo = $00000FE0;
  306.  
  307. FUNCTION NewIconActionProc(userRoutine: IconActionProcPtr): IconActionUPP;
  308.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  309.     INLINE $2E9F;
  310.     {$ENDC}
  311.  
  312. FUNCTION CallIconActionProc(theType: ResType; VAR theIcon: Handle; yourDataPtr: UNIV Ptr; userRoutine: IconActionUPP): OSErr;
  313.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  314.     INLINE $205F, $4E90;
  315.     {$ENDC}
  316.  
  317. TYPE
  318.     IconAction                            = IconActionProcPtr;
  319. {$IFC TYPED_FUNCTION_POINTERS}
  320.     IconGetterProcPtr = FUNCTION(theType: ResType; yourDataPtr: UNIV Ptr): Handle;
  321. {$ELSEC}
  322.     IconGetterProcPtr = ProcPtr;
  323. {$ENDC}
  324.  
  325.     IconGetterUPP = UniversalProcPtr;
  326.  
  327. CONST
  328.     uppIconGetterProcInfo = $000003F0;
  329.  
  330. FUNCTION NewIconGetterProc(userRoutine: IconGetterProcPtr): IconGetterUPP;
  331.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  332.     INLINE $2E9F;
  333.     {$ENDC}
  334.  
  335. FUNCTION CallIconGetterProc(theType: ResType; yourDataPtr: UNIV Ptr; userRoutine: IconGetterUPP): Handle;
  336.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  337.     INLINE $205F, $4E90;
  338.     {$ENDC}
  339.  
  340. TYPE
  341.     IconGetter                            = IconGetterProcPtr;
  342. {$IFC NOT OLDROUTINELOCATIONS }
  343.     CIconPtr = ^CIcon;
  344.     CIcon = RECORD
  345.         iconPMap:                PixMap;                                    { the icon's pixMap }
  346.         iconMask:                BitMap;                                    { the icon's mask }
  347.         iconBMap:                BitMap;                                    { the icon's bitMap }
  348.         iconData:                Handle;                                    { the icon's data }
  349.         iconMaskData:            ARRAY [0..0] OF SInt16;                    { icon's mask and BitMap data }
  350.     END;
  351.  
  352.     CIconHandle                            = ^CIconPtr;
  353. FUNCTION GetCIcon(iconID: SInt16): CIconHandle;
  354.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  355.     INLINE $AA1E;
  356.     {$ENDC}
  357. PROCEDURE PlotCIcon({CONST}VAR theRect: Rect; theIcon: CIconHandle);
  358.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  359.     INLINE $AA1F;
  360.     {$ENDC}
  361. PROCEDURE DisposeCIcon(theIcon: CIconHandle);
  362.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  363.     INLINE $AA25;
  364.     {$ENDC}
  365. {$ENDC}
  366.  
  367. FUNCTION GetIcon(iconID: SInt16): Handle;
  368.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  369.     INLINE $A9BB;
  370.     {$ENDC}
  371. PROCEDURE PlotIcon({CONST}VAR theRect: Rect; theIcon: Handle);
  372.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  373.     INLINE $A94B;
  374.     {$ENDC}
  375.  
  376.  
  377. {
  378.     Note:    IconSuiteRef and IconCacheRef should be an abstract types, 
  379.             but too much source code already relies on them being of type Handle.
  380. }
  381.  
  382. TYPE
  383.     IconSuiteRef                        = Handle;
  384.     IconCacheRef                        = Handle;
  385. {  IconRefs are 32-bit values identifying cached icon data. IconRef 0 is invalid. }
  386.     IconRef = ^LONGINT;
  387. FUNCTION PlotIconID({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theResID: SInt16): OSErr;
  388.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  389.     INLINE $303C, $0500, $ABC9;
  390.     {$ENDC}
  391. FUNCTION NewIconSuite(VAR theIconSuite: IconSuiteRef): OSErr;
  392.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  393.     INLINE $303C, $0207, $ABC9;
  394.     {$ENDC}
  395. FUNCTION AddIconToSuite(theIconData: Handle; theSuite: IconSuiteRef; theType: ResType): OSErr;
  396.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  397.     INLINE $303C, $0608, $ABC9;
  398.     {$ENDC}
  399. FUNCTION GetIconFromSuite(VAR theIconData: Handle; theSuite: IconSuiteRef; theType: ResType): OSErr;
  400.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  401.     INLINE $303C, $0609, $ABC9;
  402.     {$ENDC}
  403. FUNCTION ForEachIconDo(theSuite: IconSuiteRef; selector: IconSelectorValue; action: IconActionUPP; yourDataPtr: UNIV Ptr): OSErr;
  404.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  405.     INLINE $303C, $080A, $ABC9;
  406.     {$ENDC}
  407. FUNCTION GetIconSuite(VAR theIconSuite: IconSuiteRef; theResID: SInt16; selector: IconSelectorValue): OSErr;
  408.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  409.     INLINE $303C, $0501, $ABC9;
  410.     {$ENDC}
  411. FUNCTION DisposeIconSuite(theIconSuite: IconSuiteRef; disposeData: BOOLEAN): OSErr;
  412.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  413.     INLINE $303C, $0302, $ABC9;
  414.     {$ENDC}
  415. FUNCTION PlotIconSuite({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconSuite: IconSuiteRef): OSErr;
  416.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  417.     INLINE $303C, $0603, $ABC9;
  418.     {$ENDC}
  419. FUNCTION MakeIconCache(VAR theCache: IconCacheRef; makeIcon: IconGetterUPP; yourDataPtr: UNIV Ptr): OSErr;
  420.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  421.     INLINE $303C, $0604, $ABC9;
  422.     {$ENDC}
  423. FUNCTION LoadIconCache({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconCache: IconCacheRef): OSErr;
  424.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  425.     INLINE $303C, $0606, $ABC9;
  426.     {$ENDC}
  427. FUNCTION PlotIconMethod({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theMethod: IconGetterUPP; yourDataPtr: UNIV Ptr): OSErr;
  428.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  429.     INLINE $303C, $0805, $ABC9;
  430.     {$ENDC}
  431. FUNCTION GetLabel(labelNumber: SInt16; VAR labelColor: RGBColor; VAR labelString: Str255): OSErr;
  432.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  433.     INLINE $303C, $050B, $ABC9;
  434.     {$ENDC}
  435. FUNCTION PtInIconID(testPt: Point; {CONST}VAR iconRect: Rect; align: IconAlignmentType; iconID: SInt16): BOOLEAN;
  436.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  437.     INLINE $303C, $060D, $ABC9;
  438.     {$ENDC}
  439. FUNCTION PtInIconSuite(testPt: Point; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): BOOLEAN;
  440.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  441.     INLINE $303C, $070E, $ABC9;
  442.     {$ENDC}
  443. FUNCTION PtInIconMethod(testPt: Point; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UNIV Ptr): BOOLEAN;
  444.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  445.     INLINE $303C, $090F, $ABC9;
  446.     {$ENDC}
  447. FUNCTION RectInIconID({CONST}VAR testRect: Rect; {CONST}VAR iconRect: Rect; align: IconAlignmentType; iconID: SInt16): BOOLEAN;
  448.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  449.     INLINE $303C, $0610, $ABC9;
  450.     {$ENDC}
  451. FUNCTION RectInIconSuite({CONST}VAR testRect: Rect; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): BOOLEAN;
  452.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  453.     INLINE $303C, $0711, $ABC9;
  454.     {$ENDC}
  455. FUNCTION RectInIconMethod({CONST}VAR testRect: Rect; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UNIV Ptr): BOOLEAN;
  456.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  457.     INLINE $303C, $0912, $ABC9;
  458.     {$ENDC}
  459. FUNCTION IconIDToRgn(theRgn: RgnHandle; {CONST}VAR iconRect: Rect; align: IconAlignmentType; iconID: SInt16): OSErr;
  460.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  461.     INLINE $303C, $0613, $ABC9;
  462.     {$ENDC}
  463. FUNCTION IconSuiteToRgn(theRgn: RgnHandle; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): OSErr;
  464.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  465.     INLINE $303C, $0714, $ABC9;
  466.     {$ENDC}
  467. FUNCTION IconMethodToRgn(theRgn: RgnHandle; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UNIV Ptr): OSErr;
  468.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  469.     INLINE $303C, $0915, $ABC9;
  470.     {$ENDC}
  471. FUNCTION SetSuiteLabel(theSuite: IconSuiteRef; theLabel: SInt16): OSErr;
  472.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  473.     INLINE $303C, $0316, $ABC9;
  474.     {$ENDC}
  475. FUNCTION GetSuiteLabel(theSuite: IconSuiteRef): SInt16;
  476.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  477.     INLINE $303C, $0217, $ABC9;
  478.     {$ENDC}
  479. FUNCTION GetIconCacheData(theCache: IconCacheRef; VAR theData: UNIV Ptr): OSErr;
  480.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  481.     INLINE $303C, $0419, $ABC9;
  482.     {$ENDC}
  483. FUNCTION SetIconCacheData(theCache: IconCacheRef; theData: UNIV Ptr): OSErr;
  484.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  485.     INLINE $303C, $041A, $ABC9;
  486.     {$ENDC}
  487. FUNCTION GetIconCacheProc(theCache: IconCacheRef; VAR theProc: IconGetterUPP): OSErr;
  488.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  489.     INLINE $303C, $041B, $ABC9;
  490.     {$ENDC}
  491. FUNCTION SetIconCacheProc(theCache: IconCacheRef; theProc: IconGetterUPP): OSErr;
  492.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  493.     INLINE $303C, $041C, $ABC9;
  494.     {$ENDC}
  495. FUNCTION PlotIconHandle({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIcon: Handle): OSErr;
  496.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  497.     INLINE $303C, $061D, $ABC9;
  498.     {$ENDC}
  499. FUNCTION PlotSICNHandle({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theSICN: Handle): OSErr;
  500.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  501.     INLINE $303C, $061E, $ABC9;
  502.     {$ENDC}
  503. FUNCTION PlotCIconHandle({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theCIcon: CIconHandle): OSErr;
  504.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  505.     INLINE $303C, $061F, $ABC9;
  506.     {$ENDC}
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517. {
  518.    IconServices is an efficient mechanism to share icon data amongst multiple 
  519.    clients. It avoids duplication of data; it provides efficient caching, 
  520.    releasing memory when the icon data is no longer needed; it can provide
  521.    the appropriate icon for any filesystem object; it can provide commonly 
  522.    used icons (caution, note, help...); it is Appearance-savvy: the icons
  523.    are switched when appropriate.
  524.    To refer to a cached icon data, IconServices uses IconRef, a 32-bit
  525.    opaque value. IconRefs are reference counted. When there are no more clients 
  526.    for an IconRef, the bitmap memory associated with it is marked as disposeable. 
  527.    Two files of same type and creator with no custom icon will have the same IconRef.
  528.    Files with custom icons will have their own IconRef.
  529. }
  530.  
  531. {
  532.    Use the special creator kSystemIconsCreator to get "standard" icons 
  533.    that are not associated with a file, such as the help icon.
  534. }
  535.  
  536. CONST
  537.     kSystemIconsCreator            = 'macs';
  538.  
  539.  
  540. {
  541.    Type of the predefined/generic icons. For example, the call:
  542.    GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &iconRef);
  543.    will retun in iconRef the IconRef for the standard help icon.
  544. }
  545.  
  546. { Generic Finder icons }
  547.     kClipboardIcon                = 'CLIP';
  548.     kClippingUnknownTypeIcon    = 'clpu';
  549.     kClippingPictureTypeIcon    = 'clpp';
  550.     kClippingTextTypeIcon        = 'clpt';
  551.     kClippingSoundTypeIcon        = 'clps';
  552.     kDesktopIcon                = 'desk';
  553.     kFinderIcon                    = 'FNDR';
  554.     kFontSuitcaseIcon            = 'FFIL';
  555.     kFullTrashIcon                = 'ftrh';
  556.     kGenericApplicationIcon        = 'APPL';
  557.     kGenericCDROMIcon            = 'cddr';
  558.     kGenericControlPanelIcon    = 'APPC';
  559.     kGenericControlStripModuleIcon = 'sdev';
  560.     kGenericComponentIcon        = 'thng';
  561.     kGenericDeskAccessoryIcon    = 'APPD';
  562.     kGenericDocumentIcon        = 'docu';
  563.     kGenericEditionFileIcon        = 'edtf';
  564.     kGenericExtensionIcon        = 'INIT';
  565.     kGenericFileServerIcon        = 'srvr';
  566.     kGenericFontIcon            = 'ffil';
  567.     kGenericFontScalerIcon        = 'sclr';
  568.     kGenericFloppyIcon            = 'flpy';
  569.     kGenericHardDiskIcon        = 'hdsk';
  570.     kGenericRemovableMediaIcon    = 'rmov';
  571.     kGenericMoverObjectIcon        = 'movr';
  572.     kGenericPCCardIcon            = 'pcmc';
  573.     kGenericPreferencesIcon        = 'pref';
  574.     kGenericQueryDocumentIcon    = 'qery';
  575.     kGenericRAMDiskIcon            = 'ramd';
  576.     kGenericSharedLibaryIcon    = 'shlb';
  577.     kGenericStationeryIcon        = 'sdoc';
  578.     kGenericSuitcaseIcon        = 'suit';
  579.     kGenericWORMIcon            = 'worm';
  580.     kInternationResourcesIcon    = 'ifil';
  581.     kKeyboardLayoutIcon            = 'kfil';
  582.     kSoundFileIcon                = 'sfil';
  583.     kSystemSuitcaseIcon            = 'zsys';
  584.     kTrashIcon                    = 'trsh';
  585.     kTrueTypeFontIcon            = 'tfil';
  586.     kTrueTypeFlatFontIcon        = 'sfnt';
  587.     kTrueTypeMultiFlatFontIcon    = 'ttcf';
  588.  
  589. { Internet locations }
  590.     kInternetLocationHTTPIcon    = 'ilht';
  591.     kInternetLocationFTPIcon    = 'ilft';
  592.     kInternetLocationAppleShareIcon = 'ilaf';
  593.     kInternetLocationAppleTalkZoneIcon = 'ilat';
  594.     kInternetLocationFileIcon    = 'ilfi';
  595.     kInternetLocationMailIcon    = 'ilma';
  596.     kInternetLocationNewsIcon    = 'ilnw';
  597.     kInternetLocationGenericIcon = 'ilge';
  598.  
  599. { Folders }
  600.     kGenericFolderIcon            = 'fldr';
  601.     kDropFolderIcon                = 'dbox';
  602.     kMountedFolderIcon            = 'mntd';
  603.     kOpenFolderIcon                = 'ofld';
  604.     kOwnedFolderIcon            = 'ownd';
  605.     kPrivateFolderIcon            = 'prvf';
  606.     kSharedFolderIcon            = 'shfl';
  607.  
  608. { Sharing Privileges icons }
  609.     kSharingPrivsNotApplicableIcon = 'shna';
  610.     kSharingPrivsReadOnlyIcon    = 'shro';
  611.     kSharingPrivsReadWriteIcon    = 'shrw';
  612.     kSharingPrivsUnknownIcon    = 'shuk';
  613.     kSharingPrivsWritableIcon    = 'writ';
  614.  
  615.  
  616. { Users and Groups icons }
  617.     kUserFolderIcon                = 'ufld';
  618.     kWorkgroupFolderIcon        = 'wfld';
  619.     kGuestUserIcon                = 'gusr';
  620.     kUserIcon                    = 'user';
  621.     kOwnerIcon                    = 'susr';
  622.     kGroupIcon                    = 'grup';
  623.  
  624. { Special folders }
  625.     kAppleExtrasFolderIcon        = 'aexƒ';
  626.     kAppleMenuFolderIcon        = 'amnu';
  627.     kApplicationsFolderIcon        = 'apps';
  628.     kApplicationSupportFolderIcon = 'asup';
  629.     kAssistantsFolderIcon        = 'astƒ';
  630.     kContextualMenuItemsFolderIcon = 'cmnu';
  631.     kControlPanelDisabledFolderIcon = 'ctrD';
  632.     kControlPanelFolderIcon        = 'ctrl';
  633.     kControlStripModulesFolderIcon = 'sdvƒ';
  634.     kDocumentsFolderIcon        = 'docs';
  635.     kExtensionsDisabledFolderIcon = 'extD';
  636.     kExtensionsFolderIcon        = 'extn';
  637.     kFavoritesFolderIcon        = 'favs';
  638.     kFontsFolderIcon            = 'font';
  639.     kHelpFolderIcon                = 'ƒhlp';
  640.     kInternetFolderIcon            = 'intƒ';
  641.     kInternetPlugInFolderIcon    = 'ƒnet';
  642.     kMacOSReadMeFolderIcon        = 'morƒ';
  643.     kPreferencesFolderIcon        = 'prfƒ';
  644.     kPrinterDescriptionFolderIcon = 'ppdf';
  645.     kPrinterDriverFolderIcon    = 'ƒprd';
  646.     kPrintMonitorFolderIcon        = 'prnt';
  647.     kRecentApplicationsFolderIcon = 'rapp';
  648.     kRecentDocumentsFolderIcon    = 'rdoc';
  649.     kRecentServersFolderIcon    = 'rsrv';
  650.     kScriptingAdditionsFolderIcon = 'ƒscr';
  651.     kSharedLibrariesFolderIcon    = 'ƒlib';
  652.     kScriptsFolderIcon            = 'scrƒ';
  653.     kShutdownItemsDisabledFolderIcon = 'shdD';
  654.     kShutdownItemsFolderIcon    = 'shdf';
  655.     kSpeakableItemsFolder        = 'spki';
  656.     kStartupItemsDisabledFolderIcon = 'strD';
  657.     kStartupItemsFolderIcon        = 'strt';
  658.     kSystemExtensionDisabledFolderIcon = 'macD';
  659.     kSystemFolderIcon            = 'macs';
  660.     kTextEncodingsFolderIcon    = 'ƒtex';
  661.     kAppearanceFolderIcon        = 'appr';
  662.     kUtilitiesFolderIcon        = 'utiƒ';
  663.     kVoicesFolderIcon            = 'fvoc';
  664.     kColorSyncFolderIcon        = 'prof';
  665.     kInternetSearchSitesFolderIcon = 'issf';
  666.  
  667. { Badges }
  668.     kAppleScriptBadgeIcon        = 'scrp';
  669.     kLockedBadgeIcon            = 'lbdg';
  670.     kMountedBadgeIcon            = 'mbdg';
  671.     kSharedBadgeIcon            = 'sbdg';
  672.     kAliasBadgeIcon                = 'abdg';
  673.  
  674. { Alert icons }
  675.     kAlertNoteIcon                = 'note';
  676.     kAlertCautionIcon            = 'caut';
  677.     kAlertStopIcon                = 'stop';
  678.  
  679. { Networking icons }
  680.     kAppleTalkIcon                = 'atlk';
  681.     kAppleTalkZoneIcon            = 'atzn';
  682.     kAFPServerIcon                = 'afps';
  683.     kFTPServerIcon                = 'ftps';
  684.     kIPFileServerIcon            = 'isrv';
  685.  
  686. { Other icons }
  687.     kAppleLogoIcon                = 'capl';
  688.     kAppleMenuIcon                = 'sapl';
  689.     kBackwardArrowIcon            = 'baro';
  690.     kFavoriteItemsIcon            = 'favr';
  691.     kForwardArrowIcon            = 'faro';
  692.     kGridIcon                    = 'grid';
  693.     kHelpIcon                    = 'help';
  694.     kKeepArrangedIcon            = 'arng';
  695.     kLockedIcon                    = 'lock';
  696.     kNoFilesIcon                = 'nfil';
  697.     kNoFolderIcon                = 'nfld';
  698.     kNoWriteIcon                = 'nwrt';
  699.     kProtectedApplicationFolderIcon = 'papp';
  700.     kProtectedSystemFolderIcon    = 'psys';
  701.     kRecentItemsIcon            = 'rcnt';
  702.     kShortcutIcon                = 'shrt';
  703.     kSortAscendingIcon            = 'asnd';
  704.     kSortDescendingIcon            = 'dsnd';
  705.     kUnlockedIcon                = 'ulck';
  706.     kConnectToIcon                = 'cnct';
  707.  
  708.  
  709. {    Error codes range from -2580 to -2599 }
  710.     invalidIconRefErr            = -2580;
  711.     noSuchIconErr                = -2581;
  712.     noIconDataAvailableErr        = -2582;
  713.  
  714.  
  715. {    IconServicesUsageFlags }
  716.  
  717. TYPE
  718.     IconServicesUsageFlags                = UInt32;
  719.  
  720. CONST
  721.     kIconServicesNormalUsageFlag = 0;
  722.  
  723.  
  724. {
  725.       IconFamily 'icns' resources contain an entire IconFamily (all sizes and depths).  
  726.    For custom icons, icns IconFamily resources of the custom icon resource ID are fetched first before
  727.    the classic custom icons (individual 'ics#, ICN#, etc) are fetched.  If the fetch of the icns resource
  728.    succeeds then the icns is looked at exclusively for the icon data.
  729.    For custom icons, new icon features such as 32-bit deep icons are only fetched from the icns resource.
  730.    This is to avoid incompatibilities with cut & paste of new style icons with an older version of the
  731.    MacOS Finder.
  732.    DriverGestalt is called with code kdgMediaIconSuite by IconServices after calling FSM to determine a
  733.    driver icon for a particular device.  The result of the kdgMediaIconSuite call to DriverGestalt should
  734.    be a pointer an an IconFamily.  In this manner driver vendors can provide rich, detailed drive icons
  735.    instead of the 1-bit variety previously supported.
  736. }
  737.     kIconFamilyType                = 'icns';
  738.  
  739.  
  740.  
  741. TYPE
  742.     IconFamilyElementPtr = ^IconFamilyElement;
  743.     IconFamilyElement = RECORD
  744.         elementType:            OSType;                                    {  'ICN#', 'icl8', etc... }
  745.         elementSize:            Size;                                    {  Size of this element }
  746.         elementData:            SInt8;
  747.     END;
  748.  
  749.     IconFamilyResourcePtr = ^IconFamilyResource;
  750.     IconFamilyResource = RECORD
  751.         resourceType:            OSType;                                    {  Always 'icns' }
  752.         resourceSize:            Size;                                    {  Total size of this resource }
  753.         elements:                ARRAY [0..0] OF IconFamilyElement;
  754.     END;
  755.  
  756.     IconFamilyPtr                        = ^IconFamilyResource;
  757.     IconFamilyHandle                    = ^IconFamilyPtr;
  758.  
  759. {
  760.   ==============================================================================
  761.    Initialization and Termination
  762.   ==============================================================================
  763. }
  764.  
  765.  
  766. {
  767.    IconServicesInit
  768.    
  769.    Call this routine once per classic 68K application initialization.
  770.    This routine does not need to be called at boot time.
  771. }
  772.  
  773. FUNCTION IconServicesInit(initBlockPtr: CFragInitBlockPtr): OSErr;
  774.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  775.     INLINE $7015, $AA75;
  776.     {$ENDC}
  777.  
  778. {
  779.    IconServicesTerminate:
  780.    
  781.    Call this routine once from the termination of a classic 68K application.
  782.    This routine does not need to be called at boot time.
  783. }
  784.  
  785. PROCEDURE IconServicesTerminate;
  786.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  787.     INLINE $7016, $AA75;
  788.     {$ENDC}
  789.  
  790.  
  791. {
  792.   ==============================================================================
  793.    Converting data structures
  794.   ==============================================================================
  795. }
  796.  
  797.  
  798. {
  799.    IconRefToIconFamily
  800.    This routines returns a new IconFamily that contains the data corresponding
  801.    to the specified IconRef
  802. }
  803.  
  804. FUNCTION IconRefToIconFamily(theIconRef: IconRef; whichIcons: IconSelectorValue; VAR iconFamily: IconFamilyHandle): OSErr;
  805.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  806.     INLINE $7024, $AA75;
  807.     {$ENDC}
  808.  
  809. {
  810.    IconFamilyToIconSuite
  811.    This routines transfers the data in an icon family into an icon suite.
  812. }
  813.  
  814. FUNCTION IconFamilyToIconSuite(iconFamily: IconFamilyHandle; whichIcons: IconSelectorValue; VAR iconSuite: IconSuiteRef): OSErr;
  815.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  816.     INLINE $7025, $AA75;
  817.     {$ENDC}
  818.  
  819. {
  820.    IconSuiteToIconFamily
  821.    This routines transfers the data in an icon suite into an icon family.
  822. }
  823.  
  824. FUNCTION IconSuiteToIconFamily(iconSuite: IconSuiteRef; whichIcons: IconSelectorValue; VAR iconFamily: IconFamilyHandle): OSErr;
  825.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  826.     INLINE $7026, $AA75;
  827.     {$ENDC}
  828.  
  829. {
  830.    SetIconFamilyData
  831.    Change the data of an icon family. The data is copied.
  832.    The type can be one of the icon type, or 'PICT'
  833.    The data will be compressed if needed.
  834. }
  835.  
  836. FUNCTION SetIconFamilyData(iconFamily: IconFamilyHandle; iconType: OSType; h: Handle): OSErr;
  837.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  838.     INLINE $7030, $AA75;
  839.     {$ENDC}
  840.  
  841. {
  842.    GetIconFamilyData
  843.    Return a copy of the data in the icon family.
  844.    The type can be one of the icon type, or 'PICT'
  845.    The data will be returned uncompressed.
  846. }
  847.  
  848. FUNCTION GetIconFamilyData(iconFamily: IconFamilyHandle; iconType: OSType; h: Handle): OSErr;
  849.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  850.     INLINE $7031, $AA75;
  851.     {$ENDC}
  852.  
  853. {
  854.   ==============================================================================
  855.    Reference counting
  856.   ==============================================================================
  857. }
  858.  
  859.  
  860. {
  861.    GetIconRefOwners
  862.    
  863.    This routine returns the reference count for the IconRef, or number of owners.
  864.    
  865.    A valid IconRef always has at least one owner.
  866. }
  867.  
  868. FUNCTION GetIconRefOwners(theIconRef: IconRef; VAR owners: UInt16): OSErr;
  869.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  870.     INLINE $700B, $AA75;
  871.     {$ENDC}
  872.  
  873. {
  874.    AcquireIconRef
  875.    This routine increments the reference count for the IconRef
  876. }
  877.  
  878. FUNCTION AcquireIconRef(theIconRef: IconRef): OSErr;
  879.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  880.     INLINE $7027, $AA75;
  881.     {$ENDC}
  882.  
  883.  
  884. {
  885.    ReleaseIconRef
  886.    
  887.    This routine decrements the reference count for the IconRef.
  888.    
  889.    When the reference count reaches 0, all memory allocated for the icon
  890.    is disposed. Any subsequent use of the IconRef is invalid.
  891. }
  892.  
  893. FUNCTION ReleaseIconRef(theIconRef: IconRef): OSErr;
  894.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  895.     INLINE $7028, $AA75;
  896.     {$ENDC}
  897.  
  898.  
  899. {
  900.   ==============================================================================
  901.    Getting an IconRef
  902.   ==============================================================================
  903. }
  904.  
  905.  
  906. {
  907.    GetIconRefFromFile
  908.    
  909.    This routine returns an icon ref for the specified file, folder or volume.
  910.    The label information is provided separately, since two files with the same icon 
  911.    but a different label would share the same iconRef. The label can be used in 
  912.    PlotIconRef() for example.
  913.    
  914.    Use this routine if you have no information about the file system object. If 
  915.    you have already done a GetCatInfo on the file and want to save some I/O, 
  916.    call GetIconRefFromFolder() if you know it's a folder with no custom icon or 
  917.    call GetIconRef() if it's a file with no custom icon.
  918.    This routine increments the reference count of the returned IconRef. Call 
  919.    ReleaseIconRef() when you're done with it.
  920. }
  921.  
  922. FUNCTION GetIconRefFromFile({CONST}VAR theFile: FSSpec; VAR theIconRef: IconRef; VAR theLabel: SInt16): OSErr;
  923.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  924.     INLINE $7002, $AA75;
  925.     {$ENDC}
  926.  
  927.  
  928. {
  929.    GetIconRef
  930.    
  931.    This routine returns an icon ref for an icon in the desktop database or
  932.    for a registered icon.
  933.    The system registers a set of icon such as the help icon with the creator 
  934.    code kSystemIconCreator. See above for a list of the registered system types.
  935.    The vRefNum is used as a hint on where to look for the icon first. Use 
  936.    kOnSystemDisk if you don't know what to pass.
  937.    This routine increments the reference count of the returned IconRef. Call 
  938.    ReleaseIconRef() when you're done with it.
  939. }
  940.  
  941. FUNCTION GetIconRef(vRefNum: SInt16; creator: OSType; iconType: OSType; VAR theIconRef: IconRef): OSErr;
  942.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  943.     INLINE $7021, $AA75;
  944.     {$ENDC}
  945.  
  946.  
  947. {
  948.    GetIconRefFromFolder
  949.    
  950.    This routine returns an icon ref for a folder with no custom icon.
  951.    Use the more generic, but slightly slower, GetIconRefFromFile() if
  952.    you don't already have the necessary info about the file.
  953.    Attributes should be CInfoPBRec.dirInfo.ioFlAttrib for this folder.
  954.    Access privileges should be CInfoPBRec.dirInfo.ioACUser for this folder.
  955.    This routine increments the reference count of the IconRef. Call ReleaseIconRef() 
  956.    when you're done with it.
  957. }
  958.  
  959. FUNCTION GetIconRefFromFolder(vRefNum: SInt16; parentFolderID: SInt32; folderID: SInt32; attributes: SInt8; accessPrivileges: SInt8; VAR theIconRef: IconRef): OSErr;
  960.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  961.     INLINE $7022, $AA75;
  962.     {$ENDC}
  963.  
  964.  
  965. {
  966.   ==============================================================================
  967.    Adding and modifying IconRef
  968.   ==============================================================================
  969. }
  970.  
  971.  
  972. {
  973.    RegisterIconRefFromIconFamily
  974.    This routine adds a new entry to the IconRef registry. Other clients will be 
  975.    able to access it using the (creator, iconType) pair specified here.
  976.    Lower-case creators are reserved for the system.
  977.    Consider using RegisterIconRefFromResource() if possible, since the data 
  978.    registered using RegisterIconRefFromFamily() cannot be purged.
  979.    The iconFamily data is copied and the caller is reponsible for disposing of it.
  980.    This routine increments the reference count of the IconRef. Call ReleaseIconRef() 
  981.    when you're done with it.
  982. }
  983.  
  984. FUNCTION RegisterIconRefFromIconFamily(creator: OSType; iconType: OSType; iconFamily: IconFamilyHandle; VAR theIconRef: IconRef): OSErr;
  985.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  986.     INLINE $701C, $AA75;
  987.     {$ENDC}
  988.  
  989. {
  990.    RegisterIconRefFromResource
  991.    
  992.    Registers an IconRef from a resouce file.  
  993.    The icon data to be fetched is either classic icon data or an icon family.  
  994.    The 'icns' icon family is searched for before the classic icon data.
  995.    This routine increments the reference count of the IconRef. Call ReleaseIconRef() 
  996.    when you're done with it.
  997. }
  998.  
  999. FUNCTION RegisterIconRefFromResource(creator: OSType; iconType: OSType; {CONST}VAR resourceFile: FSSpec; resourceID: SInt16; VAR theIconRef: IconRef): OSErr;
  1000.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1001.     INLINE $7023, $AA75;
  1002.     {$ENDC}
  1003.  
  1004. {
  1005.    UnregisterIconRef
  1006.    
  1007.    Removes the specified icon from the icon cache (if there are no users of it).  
  1008.    If some clients are using this iconRef, then the IconRef will be removed when the 
  1009.    last user calls ReleaseIconRef.
  1010. }
  1011.  
  1012. FUNCTION UnregisterIconRef(creator: OSType; iconType: OSType): OSErr;
  1013.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1014.     INLINE $7008, $AA75;
  1015.     {$ENDC}
  1016.  
  1017.  
  1018. {
  1019.    UpdateIconRef
  1020.    
  1021.    Call this routine to force an update of the data for iconRef.
  1022.    
  1023.    For example after changing an icon in the desktop database or changing the custom 
  1024.    icon of a file. Note that after _adding_ a custom icon to file or folder, you 
  1025.    need to call GetIconRefFromFile() to get a new IconRef specific to this file. 
  1026.    
  1027.    This routine does nothing if the IconRef is a registered icon.
  1028. }
  1029.  
  1030. FUNCTION UpdateIconRef(theIconRef: IconRef): OSErr;
  1031.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1032.     INLINE $7009, $AA75;
  1033.     {$ENDC}
  1034.  
  1035.  
  1036. {
  1037.    OverrideIconRefFromResource
  1038.    
  1039.    This routines replaces the bitmaps of the specified IconRef with the ones
  1040.    in the specified resource file.
  1041. }
  1042.  
  1043. FUNCTION OverrideIconRefFromResource(theIconRef: IconRef; {CONST}VAR resourceFile: FSSpec; resourceID: SInt16): OSErr;
  1044.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1045.     INLINE $702A, $AA75;
  1046.     {$ENDC}
  1047.  
  1048.  
  1049. {
  1050.    OverrideIconRef
  1051.    
  1052.    This routines replaces the bitmaps of the specified IconRef with the ones
  1053.    from the new IconRef.
  1054. }
  1055.  
  1056. FUNCTION OverrideIconRef(oldIconRef: IconRef; newIconRef: IconRef): OSErr;
  1057.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1058.     INLINE $702B, $AA75;
  1059.     {$ENDC}
  1060.  
  1061. {
  1062.    RemoveIconRefOverride
  1063.    This routine remove an override if one was applied to the icon and 
  1064.    reverts back to the original bitmap data.
  1065. }
  1066.  
  1067. FUNCTION RemoveIconRefOverride(theIconRef: IconRef): OSErr;
  1068.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1069.     INLINE $701E, $AA75;
  1070.     {$ENDC}
  1071.  
  1072.  
  1073. {
  1074.   ==============================================================================
  1075.    Creating composite IconRef
  1076.   ==============================================================================
  1077. }
  1078.  
  1079.  
  1080. {
  1081.    CompositeIconRef
  1082.    
  1083.    Superimposes an IconRef on top of another one
  1084. }
  1085.  
  1086. FUNCTION CompositeIconRef(backgroundIconRef: IconRef; foregroundIconRef: IconRef; VAR compositeIconRef: IconRef): OSErr;
  1087.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1088.     INLINE $7014, $AA75;
  1089.     {$ENDC}
  1090.  
  1091. {
  1092.    IsIconRefComposite
  1093.    Indicates if a given icon ref is a composite of two other icon refs (and which ones)
  1094.    If it isn't a composite, backgroundIconRef and foreGroundIconRef will be 0.
  1095. }
  1096.  
  1097. FUNCTION IsIconRefComposite(compositeIconRef: IconRef; VAR backgroundIconRef: IconRef; VAR foregroundIconRef: IconRef): OSErr;
  1098.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1099.     INLINE $701A, $AA75;
  1100.     {$ENDC}
  1101.  
  1102.  
  1103. {
  1104.   ==============================================================================
  1105.    Using IconRef
  1106.   ==============================================================================
  1107. }
  1108.  
  1109. {
  1110.    IsValidIconRef
  1111.    Return true if the iconRef passed in is a valid icon ref
  1112. }
  1113.  
  1114. FUNCTION IsValidIconRef(theIconRef: IconRef): BOOLEAN;
  1115.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1116.     INLINE $7032, $AA75;
  1117.     {$ENDC}
  1118.  
  1119. {
  1120.    PlotIconRef
  1121.    
  1122.    This routine plots the IconRef.  It mostly takes the same parameters as PlotIconSuite.
  1123.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1124. }
  1125.  
  1126. FUNCTION PlotIconRef({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr;
  1127.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1128.     INLINE $700E, $AA75;
  1129.     {$ENDC}
  1130.  
  1131. {
  1132.    PtInIconRef
  1133.    
  1134.    This routine indicates if testPt would hit the icon designated by iconRef.
  1135.    It mostly takes the same parameters as PtInIconSuite.
  1136.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1137. }
  1138.  
  1139.  
  1140. FUNCTION PtInIconRef({CONST}VAR testPt: Point; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theIconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): BOOLEAN;
  1141.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1142.     INLINE $700F, $AA75;
  1143.     {$ENDC}
  1144.  
  1145. {
  1146.    RectInIconRef
  1147.    
  1148.    This routine indicates if testRect would intersect the icon designated by iconRef.
  1149.    It mostly takes the same parameters as RectInIconSuite.
  1150.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1151. }
  1152.  
  1153.  
  1154. FUNCTION RectInIconRef({CONST}VAR testRect: Rect; {CONST}VAR iconRect: Rect; align: IconAlignmentType; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): BOOLEAN;
  1155.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1156.     INLINE $7010, $AA75;
  1157.     {$ENDC}
  1158.  
  1159. {
  1160.    IconRefToRgn
  1161.    
  1162.    This routine returns a region for the icon.
  1163.    It mostly takes the same parameters as IconSuiteToRgn.
  1164.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1165. }
  1166.  
  1167. FUNCTION IconRefToRgn(theRgn: RgnHandle; {CONST}VAR iconRect: Rect; align: IconAlignmentType; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr;
  1168.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1169.     INLINE $7011, $AA75;
  1170.     {$ENDC}
  1171.  
  1172. {
  1173.    GetIconSizesFromIconRef
  1174.    
  1175.    This routine returns an IconSelectorValue indicating the depths and sizes of 
  1176.    icon data which are actually available.  It takes an IconSelectorValue 
  1177.    indicating which sizes/depths the caller is interested and returns an 
  1178.    IconSelectorValue indicating which sizes/depths exist.
  1179.    
  1180.    Caution:
  1181.    
  1182.    This is potentially an extremely expensive call as IconServices may be forced 
  1183.    to attempt fetching the data for the IconRef's sizes/depths which may result 
  1184.    in hitting the local disk or even the network to obtain the data to determine 
  1185.    which sizes/depths actually exist.
  1186.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1187. }
  1188.  
  1189. FUNCTION GetIconSizesFromIconRef(iconSelectorInput: IconSelectorValue; VAR iconSelectorOutputPtr: IconSelectorValue; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr;
  1190.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1191.     INLINE $7012, $AA75;
  1192.     {$ENDC}
  1193.  
  1194.  
  1195. {
  1196.   ==============================================================================
  1197.    Flushing IconRef data
  1198.   ==============================================================================
  1199. }
  1200.  
  1201.  
  1202. {
  1203.    FlushIconRefs
  1204.    
  1205.    Making this call will dispose of all the data for the specified icons if 
  1206.    the data can be reacquired, for example if the data is provided from a resource.
  1207.    '****' is a wildcard for all types or all creators.
  1208. }
  1209.  
  1210. FUNCTION FlushIconRefs(creator: OSType; iconType: OSType): OSErr;
  1211.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1212.     INLINE $7029, $AA75;
  1213.     {$ENDC}
  1214.  
  1215. {
  1216.    FlushIconRefsByVolume
  1217.    
  1218.    This routine disposes of the data for the icons related to the indicated volume
  1219.    if this data can be reacquired, for example if the data is provided from a 
  1220.    resource.
  1221. }
  1222.  
  1223. FUNCTION FlushIconRefsByVolume(vRefNum: SInt16): OSErr;
  1224.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1225.     INLINE $7018, $AA75;
  1226.     {$ENDC}
  1227.  
  1228.  
  1229. {
  1230.   ==============================================================================
  1231.    Controling custom icons
  1232.   ==============================================================================
  1233. }
  1234.  
  1235.  
  1236. {
  1237.    SetCustomIconsEnabled
  1238.    
  1239.    Enable or disable custom icons on the specified volume.
  1240. }
  1241.  
  1242. FUNCTION SetCustomIconsEnabled(vRefNum: SInt16; enableCustomIcons: BOOLEAN): OSErr;
  1243.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1244.     INLINE $701F, $AA75;
  1245.     {$ENDC}
  1246.  
  1247. {
  1248.    GetCustomIconsEnabled
  1249.    
  1250.    Return true if custom icons are enabled on the specified volume, false otherwise.
  1251. }
  1252.  
  1253. FUNCTION GetCustomIconsEnabled(vRefNum: SInt16; VAR customIconsEnabled: BOOLEAN): OSErr;
  1254.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1255.     INLINE $7020, $AA75;
  1256.     {$ENDC}
  1257.  
  1258.  
  1259. {$ALIGN RESET}
  1260. {$POP}
  1261.  
  1262. {$SETC UsingIncludes := IconsIncludes}
  1263.  
  1264. {$ENDC} {__ICONS__}
  1265.  
  1266. {$IFC NOT UsingIncludes}
  1267.  END.
  1268. {$ENDC}
  1269.